<!--
 * @Author:
 * @Date: 2023-04-17 17:41:51
 * @LastEditors:
 * @LastEditTime: 2023-04-24 16:21:01
 * @FilePath: \immoka-admin\src\views\anchorManagement\songList.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name} , All Rights Reserved.
-->
<template>
    <div class="m-2 p-3" v-enter-helper="[initData, listQuery, meta]">
      <el-card>
        <el-table :data="tableData" border v-loading="loading">
          <el-table-column label="歌单名称" prop="title"></el-table-column>
          <el-table-column label="创建时间" prop="created_at"></el-table-column>
          <el-table-column label="歌曲数量" prop="num"></el-table-column>
          <el-table-column label="操作" width="180px">
            <template slot-scope="{row}">
              <el-button
                icon="el-icon-edit"
                plain
                size="mini"
                type="primary"
                @click="handleCheck(row)"
              >查看
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- <el-pagination
          class="mt-3 text-right"
          background
          layout="total, prev, pager, next"
          :total="meta.total"
          @current-change="handleCurrentChange"
        >
        </el-pagination> -->
      </el-card>
    </div>
</template>

<script>
  import { songSheetList } from '@/api/sys/anchorList'

  export default {
    name: "financialStatements",
    data() {
      return {
        loading: false,
        listQuery: {
          start_time: undefined,
          end_time: undefined
        },
        dateList: [],
        tableData: [],
        meta: {
          page: 1,
          page_size: 10,
          total: 0
        }
      };
    },
    created() {
      this.listQuery.user_id = this.$route.query.user_id
      this.initData();
    },
    methods: {
      initData(params) {
        this.loading = true;
        for (let key in this.listQuery) {
          this.listQuery[key] = this.listQuery[key] === '' ? undefined : this.listQuery[key]
        }
        songSheetList(this.listQuery)
          .then(res => {
            const {
              data
            } = res;
            this.tableData = data;
            // this.meta.page = current_page;
            // this.meta.total = total;
          })
          .finally(() => (this.loading = false));
      },
      handleCurrentChange(page) {
        this.meta.page = page;
        this.initData(this.listQuery);
      },
      handleCheck(row) {
        this.$router.push({
            path: 'songListDetails',
            query: {
              user_id: this.$route.query.user_id,
              id: row.id
            }
        })
      }
    }
  };
</script>

<style scoped></style>
